﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Drempelvrij.Models.Entities;
using Drempelvrij.DAL.UnitOfWork;
using NHibernate;
using Drempelvrij.DAL.SessionStorage;

namespace Drempelvrij.DAL.Repositories
{
    public class BestratingRepository : Repository<Bestrating, int>, IBestratingRepository
    {
        public BestratingRepository(IUnitOfWork uow)
            : base(uow)
        {
        }

        public List<Bestrating> FindBestratingByStreetName(string streetName)
        {
            ICriteria criteriaQuery = SessionFactory.GetCurrentSession()
                    .CreateCriteria(typeof(Bestrating))
                    .Add(NHibernate.Criterion.Restrictions.Eq("StraatNaam", streetName));

            return (List<Bestrating>)criteriaQuery.List<Bestrating>();
        }
    }
}
